<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<select id='idxia'>
			<option value="">请选择大小</option>
			<option value="大">大</option>
			<option value="小">小</option>
		</select>
		<br>
		<img src="css/1.jpg" id="tu_id" style="width: 300px; height: 300px;">
		<br>
		<button type="button" onclick="kai();">开始</button>
	</body>
	<script type="text/javascript">
		function kai(){
			var idxia= document.getElementById('idxia');
			if (idxia.value=='') {
				alert('请选择下注');
				location.reload();
			}
			var tu_id= document.getElementById('tu_id');
			var r=0;
			var num=0;
			var tu=setInterval(function(){
				r=sui();
				tu_id.src='css/'+r+'.jpg';
				tu_id.style.width='300px';
				tu_id.style.height='3oopx';
				num++;
				if (num==10) {
					clearInterval(tu);
					setTimeout(function(){
						if (idxia.value=='大') {
							if (r>3) {
								alert('恭喜你，猜对了！')
							}else{
								alert('笨蛋，猜错了！')
							}
						}else if (idxia.value=='小') {
							if (r<4) {
								alert('恭喜你，猜对了！')
							} else{
								alert('笨蛋，猜错了！')
							}
						}
					},1000)
				}
			},200)		
		}
		function sui(){
			var r=0;
			while (true){
				r= Math.floor(Math.random()*10)
				if (r>0&&r<7) {
					break;
				}
			}
			return r;
		}
	</script>
</html>
